//- Copyright (C) 2023 Beijing Huaxia Chunsong Technology Co., Ltd. 
//- <https://www.chatopera.com>, Licensed under the Chunsong Public 
//- License, Version 1.0  (the "License"), https://docs.cskefu.com/licenses/v1.html
//- Unless required by applicable law or agreed to in writing, software
//- distributed under the License is distributed on an "AS IS" BASIS,
//- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//- See the License for the specific language governing permissions and
//- limitations under the License.
//- Copyright (C) 2018-Jun. 2023 Chatopera Inc, <https://www.chatopera.com>
//- Licensed under the Apache License, Version 2.0
//- http://www.apache.org/licenses/LICENSE-2.0
extends /apps/include/layout.pug
include /mixins/client.mixin.pug
block content
    .layui-side.layui-bg-black
        .layui-side-scroll
            include /apps/service/include/left.pug
    .layui-body
        .layui-side-scroll
            .row
                .col-lg-12
                    h1.site-h1(style='border-top:1px solid #e6e6e6;') 排队队列 #{agentUserList.totalElements ? "（" + agentUserList.totalElements + "）" : "（0）"}
                    table.layui-table(lay-skin='line')
                        thead
                            tr.design-sortable-tr
                                th 用户名
                                th 接入渠道
                                th 技能组
                                th 地域
                                th 接入时间
                                th 等待时长
                                th(style='width:1%', nowrap) 操作
                        tbody
                            if agentUserList.content.size() > 0
                                for agentUser in agentUserList.content
                                    tr.tdHasContorllor.design-dropable-td
                                        td.first_td_head
                                            a(href="/service/online/index.html?userid=" + agentUser.userid + "&channel=" + agentuser.channeltype) #{agentUser.username}
                                        td #{agentuser.channeltype}
                                        td #{agentUser.skillname}
                                        td #{agentUser.region}
                                        td #{pugHelper.formatDate('yyyy-MM-dd HH:mm:ss', agentUser.createtime)}
                                        td #{pugHelper.padRight(agentUser.waittingtime / (1000*60*60), "00")}:#{pugHelper.padRight(agentUser.waittingtime % (1000*60*60) / (1000*60), "00")}:#{pugHelper.padRight(agentUser.waittingtime % (1000*60) / 1000, "00")}
                                        td(style="width:1%" nowrap="nowrap")
                                            a(href="/service/quene/transfer.html?id=" + agentUser.id + "&skillid=" + agentUser.skill, data-toggle="ajax", data-width="550", data-height="350", title="转队列")
                                                i.kfont &#xe62c;
                                                | 转队列
                                            a(href="/service/quene/invite.html?id=" + agentUser.id, data-toggle="tip", data-title="邀请对话会加入到您的对话列表中，请确认是否开始对话？", style="margin-left:10px;")
                                                i.kfont &#xe609;
                                                | 邀请对话
                                            a(href="/service/trace.html?id=" + agentUser.sessionid, title="查看访客轨迹", data-toggle="ajax", data-width="1050", style="margin-left:10px;")
                                                i.kfont &#xe638;
                                                | 轨迹
                            else
                                tr
                                    td(colspan="20" style="height:400px;")
                                        .ukefu-empty(style="background: none")
                                            i.layui-icon &#xe63a;
                                            div(style="") 当前没有排队访客
            .row(style='padding:5px;')
                .col-lg-12#page(style='text-align:center;')
    script.
        layui.use(['laypage', 'layer'], function(){
                  var laypage = layui.laypage
                  ,layer = layui.layer;

                  laypage({
                        cont: 'page'
                      , pages: #{agentUserList ? agentUserList.totalPages : 0} //总页数
                      , curr: #{agentUserList ? agentUserList.number + 1 : 0}
                        ,groups: 5 //连续显示分页数
                        ,jump:function(data , first){
                            if(!first){
                                location.href = "/service/quene/index.html?p="+data.curr ;
                            }
                        }
                   });
                });
            
